<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    <select v-model="selected" >
        <option disabled value="">请选择</option>
        <option v-for="r in roles" :value="r.id">{{r.name}}:{{r.comment}}</option>
    </select>
    <span>Selected: {{ selected }}</span>
</div>
</body>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
<script>
    var app = new Vue({
        el: '#app',
        data: {
            roles: [],
            selected: '',
        },
        created() {
            $.ajax({
                dataType: "json",
                url: "http://localhost:8080/role/select",
                success: (res) => {
                    console.log(res);//打印服务端返回的数据(调试用)
                    this.roles = res;
                    console.log(this.roles);
                },
            })
        }
    })
</script>
</html>